home *** CD-ROM | disk | FTP | other *** search
/ Trusted Irix /B 4.0.4 / Trusted-Irix B-4.0.1.iso / dist / eoe1.idb / usr / include / sys / lv.h.z / lv.h
C/C++ Source or Header  |  1992-04-03  |  4KB  |  114 lines

  1.  
  2. /**************************************************************************
  3.  *                                      *
  4.  *          Copyright (C) 1989, Silicon Graphics, Inc.          *
  5.  *                                      *
  6.  *  These coded instructions, statements, and computer programs  contain  *
  7.  *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
  8.  *  are protected by Federal copyright law.  They  may  not be disclosed  *
  9.  *  to  third  parties  or copied or duplicated in any form, in whole or  *
  10.  *  in part, without the prior written consent of Silicon Graphics, Inc.  *
  11.  *                                      *
  12.  **************************************************************************/
  13.  
  14. #ident "$Revision: 1.7 $"
  15.  
  16. /* Structures for logical volume driver */
  17. /* Author: Dave Higgen (daveh) @ SGI */
  18.  
  19. /* structure per physical dev which is part of a logical volume */
  20.  
  21. struct physdev    {
  22.  
  23.     dev_t    dev;
  24.     daddr_t start;    /* in bbs, relative to start of logical volume space */
  25.     daddr_t    size;
  26.     unsigned spare; /* possible future expansion */
  27.     };
  28.  
  29. /* Info defining the logical volume */
  30.  
  31. struct lv    {
  32.  
  33.     unsigned l_flags;    /* everyone, as they say, needs some flags */
  34.     unsigned l_ndevs;    /* number of devices making up the volume */
  35.     unsigned l_stripe;     /* number of ways volume is striped. */
  36.     unsigned l_gran;    /* Granularity of striping in bbs */
  37.     daddr_t  l_size;    /* Total size of volume in bbs */
  38.     unsigned l_align;    /* suggested alignment for mkfs. */
  39.     unsigned l_mindex;    /* offset into pd array where mirror devices
  40.                  * start; 0 if no mirroring.
  41.                  */
  42.     unsigned spare1;
  43.     unsigned spare2;    /* room for the future! */
  44.     struct  physdev pd[1];    /* Actually more, allocated as reqd */
  45.     };
  46.  
  47. typedef struct lv *lvptr;    /* for succinct reference */
  48.  
  49. #define L_OPEN_CHR 0x01    /* logvol device is open for char I/O. */
  50. #define L_OPEN_MNT 0x02    /* logvol device is open for fs I/O. */
  51. #define L_OPEN_BLK 0x04    /* logvol device is open for blk I/O. */
  52. #define L_OPEN_SWP 0x08    /* logvol device is open for swap I/O. (unlikely!) */
  53. #define L_OPEN_LYR 0x10    /* logvol device open from higher driver. (unlikely!) */
  54.  
  55. #define L_OPENMASK 0x1f
  56. #define L_ISOPEN(x)  (x & L_OPENMASK)
  57.  
  58. /* NOTE that if striping, the pd array is regarded as one or more stripegroups
  59.  *   each of l_stripe physdev structs. (ie it's effectively 2 dimentional). 
  60.  *   ALSO: 
  61.  *    a) The number of physdevs must be the same in each stripegroup.
  62.  *       (ie l_ndevs must be an exact multiple of l_stripe).
  63.  *
  64.  *    b) The sizes of the devices within a stripegroup must be the same!
  65.  *
  66.  *    c) The size of the physdevs must be an exact multiple of the
  67.  *       striping granularity; routines which set up an lv struct must
  68.  *       round down the actual dev sizes if necessary.  
  69.  */
  70.  
  71. /* Now a macro to give the size of an lv struct with n members. */
  72.  
  73. #define LVSIZE(n) (sizeof (struct lv) + ((n - 1) * sizeof (struct physdev)))
  74.  
  75. struct lvioarg    {     /* for IOCTLS which set/get the lv structure. */
  76.     lvptr    lvp;    /* ptr to lv struct in user mem. */
  77.     unsigned size;    /* # bytes to move between driver & user space. */
  78.     };
  79.  
  80.  
  81. /* Now some stuff concerned with dynamically allocating buffer headers.
  82.    Basic problem: we can't call kern_free at interrupt time since it does
  83.    psemas! So we have to just queue up allocated memory; the next 
  84.    time we need memory we'll see if anything queued will serve, and free the
  85.    rest. Only needed by the driver. */
  86.  
  87. #ifdef _KERNEL
  88.  
  89. struct lvmem    {
  90.     struct lvmem     *next;
  91.     unsigned    bufs;
  92.     unsigned    privmem;
  93.     struct buf    buf[1];
  94.     };
  95.  
  96. typedef struct lvmem *lvmptr;
  97.  
  98. /* It is necessary to impose a maximum on the number of blocks which may
  99.  * be handled in one lvstrategy call (since the lv driver must be able to
  100.  * reserve memory to handle the "largest expected" transaction.
  101.  */
  102.  
  103. #define LV_MAXBLOCKS    2048
  104. #endif
  105.  
  106. /* For the utilities, though not the driver, we need the structures for 
  107.  * the on-disk logical volume labels and the lvtab entries.
  108.  */
  109.  
  110. #ifndef _KERNEL
  111. #include "lvtab.h"
  112. #include "lvlabel.h"
  113. #endif
  114.